var userAutocompleteCombo;
var trackersIMEAutocompleteCombo;
var trackersAutocompleteCombo;
Ext.onReady(function(){

var proxy = new Ext.data.HttpProxy({
    method: 'GET',
    prettyUrls: false,
    url: './queryUsers.jsp', // see options parameter for Ext.Ajax.request

    api: {
        // all actions except the following will use above url

        create  : './queryUsers.jsp',
        update  : './queryUsers.jsp'
    }
});

    // simple array store
    var store = new Ext.data.ArrayStore({
    	autoLoad:true,
        fields: ['userid', 'name'],
        proxy:proxy
    });
    
    if(Ext.get('userAutocomplete')){
	    userAutocompleteCombo = new Ext.form.ComboBox({
	        store: store,
	        displayField:'name',
	        valueField:'name',
	        typeAhead: true,
	        mode: 'remote',
	        minChars:1,
	        autoSelect:false,
	        queryDelay:2500,
	        forceSelection:false,
	        triggerAction: 'all',
	        emptyText:search_select_user,
	        selectOnFocus:true,
	        applyTo: 'userAutocomplete'
	    });
	    userAutocompleteCombo.on('select', function(obj, info){
	    	if(typeof onUserSelect != 'undefined'){
	    		onUserSelect(info.data);
	    	}
	    }, userAutocompleteCombo);
    }
    


    var proxy2 = new Ext.data.HttpProxy({
        method: 'GET',
        prettyUrls: false,
        url: './queryTrackers.jsp', // see options parameter for Ext.Ajax.request

        api: {
            // all actions except the following will use above url

            create  : './queryTrackers.jsp',
            update  : './queryTrackers.jsp'
        }
    });


 // simple array store
    var store2 = new Ext.data.ArrayStore({
    	autoLoad:true,
        fields: ['trackerid', 'trackername'],
        proxy:proxy2
    });
    
    if(Ext.get('trackersAutocomplete')){
	    trackersAutocompleteCombo = new Ext.form.ComboBox({
	        store: store2,
	        displayField:'trackername',
	        valueField:'trackername',
	        typeAhead: true,
	        mode: 'remote',
	        minChars:1,
	        autoSelect:false,
	        queryDelay:2500,
	        forceSelection: false,
	        triggerAction: 'all',
	        emptyText:search_select_tracker,
	        selectOnFocus:true,
	        applyTo: 'trackersAutocomplete'
	    });
    }


    var proxy3 = new Ext.data.HttpProxy({
        method: 'GET',
        prettyUrls: false,
        url: './queryTrackersIME.jsp', // see options parameter for Ext.Ajax.request

        api: {
            // all actions except the following will use above url

            create  : './queryTrackersIME.jsp',
            update  : './queryTrackersIME.jsp'
        }
    });

return; //  User tracker id not need
 // simple array store
    var store3 = new Ext.data.ArrayStore({
    	autoLoad:true,
        fields: ['trackerid', 'usertrackerid'],
        proxy:proxy3
    });
    trackersIMEAutocompleteCombo = new Ext.form.ComboBox({
        store: store3,
        displayField:'usertrackerid',
        valueField:'usertrackerid',
        typeAhead: true,
        mode: 'remote',
        minChars:1,
        autoSelect:false,
        queryDelay:2500,
        forceSelection: false,
        triggerAction: 'all',
        emptyText:'Select a ID...',
        selectOnFocus:true,
        applyTo: 'trackersIMEAutocomplete'
    });
    

    
    });